<?php
/**
* IMMOPHP
* @author Drouche Romain
* @desc Genere le formulaire de modification d annonce
**/
require 'kernel/common.php';

if(!$annonce_id = retrieve('GET', 'annonce_id', true))
{
    redirect('annonce.php');   
}
	
$Annonce = $db->sql_query("SELECT * FROM immo_annonce WHERE id = '". $annonce_id ."'", 'ARRAY');

if($db->nb_resultat != 1)
{
    redirect('annonce.php');  
}

$smarty->assign('lang', $lang);
$smarty->assign('annonce', $Annonce);
$smarty->assign('token', $Session->_session['token']);
$smarty->assign('description_champ', get_ckeditor('description', $Annonce['description']), 'simple' );

$Immophp->getTypeFormSelect($type_array, $Annonce['type'] , array(''   =>  '-----'));
$Immophp->getAgenceFormSelect($Annonce['agence'], array('' => '-----'));
$Immophp->getSecteurFormSelect($Annonce['secteur'], array('' => '-----'), false);
$Immophp->getDepartementFormSelect($Annonce['departement'], array('' => '-----'));

$smarty->display('annonce_edition.tpl');

?>
	